<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
</head>
<link href="<?php echo $this->baseUrl;?>/admincss/style.css" rel="stylesheet" type="text/css" />
<body>
<form id="form1" name="form1" method="post" enctype="multipart/form-data" action="<?php echo $this->url ($this->baseUrl, "ad", "doedit", "", "admin");?>">
<input type="hidden" name="id" value="<?php echo $this->info['id'];?>" />

  <table width="100%" border="1" class="tableA" >
    <tr>
      <td colspan="3" align="center">编辑广告</td>
    </tr>
    <tr>
      <td>名称</td>
      <td><label for="title"></label>
      <input name="image" type="file" id="image" size="30" onchange="javascript:return fileCheck();" />
      <?php echo '<a href="' . $this->baseUrl . $this->info['image'] . '" target=_blank><img border=0 height=50 width=50 src="' . $this->baseUrl . $this->info['image'] . '"></a>'?>
      </td>
      <td>广告图片,大小100*100</td>
    </tr>
    <tr>
      <td>链接</td>
      <td><label for="title"></label>
      <input name="url" type="text" id="url" size="50" value="<?php echo htmlspecialchars($this->info['url']);?>"/></td>
      <td>&nbsp;</td>
    </tr>
    <tr>
      <td>点击数</td>
      <td><input name="hits" type="text" id="hits"  size="10" value="<?php echo htmlspecialchars($this->info['hits']);?>"/></td>
      <td></td>
    </tr>
    <tr>
      <td colspan="3" align="center"><input type="submit" name="button" id="button" value="提交" class="btn_submit"/></td>
    </tr>
  </table>
</form>
</body>
</html>
<script>
/**
 * 对所选择的文件类型加以判断
 */
function fileCheck(){
  var postfix = form1.image.value.match(/^(.*)(\.)(.{1,8})$/)[3].toLowerCase(); //获得选择的上传文件的后缀名的正则表达式
  if(!(postfix == "jpg"||postfix == "png"||postfix == "gif")) 
   { 
     alert('文件类型不正确，请选择jpg、png、gif文件 ！'); 
     var nf = form1.image.cloneNode(true); 
       nf.value=''; 
       form1.image.parentNode.replaceChild(nf, form1.image); 
     return false; 
   } 
}
</script>